<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>center1</title>
    <style>
        .center-vertical{
           width: 100px;
            height: 100px;
           background: orange;
           position: absolute;
           top: 50%;
           left: 50%;
           margin-top: -50px; /*高度的一半*/
           margin-left: -50px; /*宽度的一半*/
        }
    </style>
</head>
<body>
    <div class="center-vertical"></div>
</body>
</html>
